﻿using System;
using System.Web.UI;
using JinJiang.BookingEngine.Services;

namespace JinJiang.BookingEngine.Web.cn
{
    public partial class SearchResv : Page
    {
        JJResvlogClass resv = new JJResvlogClass();
        public string domain;
        #region 页面加载   获得用户名.注册ajax类
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //this.ClientScript.RegisterClientScriptBlock(this.GetType(), "bodyonload", "<script language=javascript>document.body.onload=function(){ SearchResv();}</script>");

            domain = "http://www.jinjianghotels.com";
            string domainurl = "";
            if (Request.UrlReferrer != null)
                domain = FGBCommon.WebDomain(false, out domainurl);
            bodyBooking.Attributes.Add("onload", "fSetOutLinkIframe('" + domain + "')");

            AjaxPro.Utility.RegisterTypeForAjax(typeof(SearchResv), this);

            if (Request.QueryString["confnum"] != null && Request.QueryString["confnum"] != "")
            {
                this.txtConfnum.Text = Request.QueryString["confnum"].ToString();
            }
            if (!string.IsNullOrEmpty(LoginInfo.LoginName))
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "span", "<script>document.getElementById(\"spanLastName\").style.display =\"none\";</script>");

            }
            else
            {
                ltrTip.Text = "(请输入您的预订确认号及对应的姓查询)";
            }
        }
        #endregion
        #region 返回对应confnum下的预订记录，并根据status显示修改，取消链接
        /// <summary>
        /// 返回对应confnum下的预订记录，并根据status显示修改，取消链接
        /// </summary>
        /// <param name="confnum">确认号</param>
        /// <returns>string 表格html</returns>
        [AjaxPro.AjaxMethod]
        public string GetSearchRecord(string confnum1, string Lastname)
        {
            string cardnumber = LoginInfo.Member != null ? LoginInfo.Member.UserId : string.Empty;
            return resv.GetSearchRecord(confnum1, Lastname, cardnumber);

        }
        #endregion


        #region 预订修改，返回表格HTML
        /// <summary>
        /// 预订修改，返回表格HTML
        /// </summary>
        /// <param name="propertyID">酒店PID</param>
        /// <param name="confnum">确认号</param>
        /// <param name="firstname">客户名</param>
        /// <param name="lastname">客户姓</param>
        /// <param name="GuestAddressLine1">客户地址</param>
        /// <param name="GuestPhone">客户电话</param>
        /// <param name="GuestEmail">客户email</param>
        /// <param name="remark">客户备注</param>

        [AjaxPro.AjaxMethod]
        public string ModRecord(string confnum1, string firstname1, string lastname1, string GuestAddressLine11, string GuestPhone1, string GuestEmail1, string remark1)
        {
            return resv.ModRecord(confnum1, firstname1, lastname1, GuestAddressLine11, GuestPhone1, GuestEmail1, remark1);
        }
        #endregion

        #region 取消修改，返回表格HTML
        /// <summary>
        /// 取消修改，返回表格HTML
        /// </summary>
        /// <param name="confnum">确认号</param>
        /// <param name="gid">用户ID</param>
        [AjaxPro.AjaxMethod]
        public string CxlRecord(string confnum)
        {
            return resv.CxlRecord(confnum);
        }
        #endregion

        #region 重发确认信email，返回表格HTML
        /// <summary>
        /// 取消修改，返回表格HTML
        /// </summary>
        /// <param name="confnum">确认号</param>
        /// <param name="type">发送类型</param>
        /// <param name="gid">gid</param>
        /// <returns></returns>
        [AjaxPro.AjaxMethod]
        public string ReSendEmail(string confnum, string type)
        {
            return resv.ReSendEmail(confnum, type);
        }
        #endregion
    }
}